package com.bdqn.controller;

import com.bdqn.pojo.HisScheduling;
import com.bdqn.service.HisSchedulingService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//排班控制器
@RestController
@CrossOrigin
@RequestMapping("/HisScheduling")
public class HisSchedulingController {
    @Autowired
    HisSchedulingService hisSchedulingService;
//    分页查询排班
    @GetMapping("getHisScheduling")
    public PageInfo<HisScheduling> getHisScheduling(@RequestParam(value = "pageNum",defaultValue = "1",required = false) int pageNum,
                                                    @RequestParam(value = "pageSize",defaultValue = "9",required = false) int pageSize,
                                                    @RequestParam(value = "userId",defaultValue = "0",required = false) int userId,
                                                    @RequestParam(value = "deptId",defaultValue = "0",required = false) int deptId){
        PageInfo<HisScheduling> pageInfo=hisSchedulingService.getHisScheduling(pageNum,pageSize,userId,deptId);
        return pageInfo;
    }
    //查询本周信息  int userId, String subsectionType, String startDate, String endDate
    @GetMapping("getScheduleWeekDate")
    public List<HisScheduling> getScheduleWeekDate(@RequestParam(value = "endDate",defaultValue = "",required = false) String endDate,//结束日期
                                                    @RequestParam(value = "startDate",defaultValue = "",required = false) String startDate,//开始日期
                                                    @RequestParam(value = "userId",defaultValue = "2",required = false) int userId,
                                                    @RequestParam(value = "subsectionType",defaultValue = "101",required = false) String subsectionType){

        List<HisScheduling> list=hisSchedulingService.getScheduleWeekDate(2,"1","2020-01-01","2021-01-01");
        System.out.println(list);
        return list;
    }

    //挂号收费

}
